import utime
from machine import I2C, Pin
from mpu9250 import MPU9250

i2c = I2C(scl=Pin(22), sda=Pin(21))
sensor = MPU9250(i2c)

print("MPU9250 id: " + hex(sensor.whoami))

while True:
    try:
        print(sensor.acceleration)#加速度
        print(sensor.gyro)#陀螺仪
        print(sensor.magnetic)#磁性
        #print(sensor.temperature)温度
        utime.sleep_ms(1000)
    except :
        print('error')
